using UnityEngine;
using UnityEngine.Playables;

public class AnimMovePlayableAsset : PlayableAsset
{
    public ExposedReference<Transform> player;
    public ExposedReference<Transform> target;
    public ExposedReference<Transform> gardenCar;
    public float carOffset;
    public bool moveRecentLand;
    public bool ignoreRecordBackPos;
    public bool changeForward;

    public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
    {
        var playable = ScriptPlayable<AnimMovePlayableBehaviour>.Create(graph);
        var movePlayerBehaviour = playable.GetBehaviour();
        var targetTrans = target.Resolve(graph.GetResolver());
        movePlayerBehaviour.Initialize(player.Resolve(graph.GetResolver()), targetTrans, ignoreRecordBackPos);
        movePlayerBehaviour.gardeCar = gardenCar.Resolve(graph.GetResolver());
        movePlayerBehaviour.carOffset = carOffset;
        movePlayerBehaviour.changeForward = changeForward;
        movePlayerBehaviour.changeForwardValue = targetTrans.forward;
        return playable;
    }
}
